<template>
  <div class="app-container">
    <el-form ref="form" :model="formData" label-width="120px">
      <el-form-item label="商品名称">
        <el-input v-model="formData.name"></el-input>
      </el-form-item>
      <el-form-item label="商品颜色">
        <el-select v-model="formData.region" placeholder="请选择商品颜色">
          <el-option label="白色" value="灰色"></el-option>
          <el-option label="黑色" value="黑色"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="商品价格">
         <el-input-number v-model="formData.price" :precision="2" :step="0.1" />
      </el-form-item>
       <el-form-item label="商品单位" class="col-4 m-2">
        <el-input v-model="formData.unit" class="w-50 m-2"></el-input>
      </el-form-item>
      <el-form-item label="是否启用">
        <el-switch v-model="formData.delivery"></el-switch>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">Create</el-button>
        <el-button @click="onCancel">Cancel</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import Tinymce from "@/components/Tinymce";
import { ref } from "vue"
import { Message } from "element-ui"
const form = ref()
const formData = ref({
  name: "",
  region: "",
  date1: "",
  date2: "",
  delivery: false,
  type: [],
  resource: "",
  desc: ""
})
const onSubmit = () => {
  console.log(this.form)
  Message("submit!");
}
const onCancel = () => {
  Message({
    message: "cancel!",
    type: "warning"
  });
}
</script>

<style scoped>
.line {
  text-align: center;
}
.col-4 {
  width: 300px;
}


</style>

